home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / os2 / sio124.arj / SIOREF.TXT < prev    next >
Text File  |  1993-12-22  |  71KB  |  1,850 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.                                           SIO
  27.                               Technical Reference Manual
  28.  
  29.  
  30.  
  31.                         Copyright (c) 1993 by Raymond L. Gwinn
  32.                                  12469 Cavalier Drive
  33.                               Woodbridge, Virginia 22192
  34.                                  All Rights Reserved
  35.  
  36.                                   December 20, 1993
  37.  
  38.  
  39.                                 CompuServe: 71154,575
  40.                              InterNet: p00321@psilink.com
  41.                                 Voice: 1-703-494-4673
  42.                                  FAX: 1-703-494-0595
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                                      INTRODUCTION
  68.  
  69.           Documentation of software is often more difficult than writing
  70.           the program itself (at least it is for this author).  I will do
  71.           my best though.
  72.  
  73.           But who do I document for?  The user that is setting up a BBS
  74.           just wants to get SIO installed and to move on to more important
  75.           things.  The user that is having problems needs information about
  76.           serial I/O communications in general and the PC specifically. 
  77.           The application developer (programmer) needs detailed information
  78.           about each individual function and the information generated.
  79.  
  80.           The answer is, more than one manual is needed.  This manual is
  81.           intended as a reference for use by application programmers that
  82.           desires to use SIO.  A separate Users Manual is included in the
  83.           distribution file(s).
  84.  
  85.           This manual and the software described is provided as is and with
  86.           no guarantees.  Use at your own risk.
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.           ii
  95.  
  96.  
  97.           WHAT IS SIO . . . . . . . . . . . . . . . . . . . . . . . . .   1
  98.  
  99.           File System Requests  . . . . . . . . . . . . . . . . . . . .   2
  100.                Driver Initialization  . . . . . . . . . . . . . . . . .   2
  101.                Read . . . . . . . . . . . . . . . . . . . . . . . . . .   2
  102.                Input Status . . . . . . . . . . . . . . . . . . . . . .   2
  103.                Input Flush  . . . . . . . . . . . . . . . . . . . . . .   3
  104.                Write  . . . . . . . . . . . . . . . . . . . . . . . . .   3
  105.                Output Status  . . . . . . . . . . . . . . . . . . . . .   3
  106.                Output Flush . . . . . . . . . . . . . . . . . . . . . .   3
  107.                Open . . . . . . . . . . . . . . . . . . . . . . . . . .   3
  108.                     Initial Open  . . . . . . . . . . . . . . . . . . .   4
  109.                     Additional Open . . . . . . . . . . . . . . . . . .   4
  110.                Close  . . . . . . . . . . . . . . . . . . . . . . . . .   4
  111.                     Intermediate Close  . . . . . . . . . . . . . . . .   5
  112.                     Last Close  . . . . . . . . . . . . . . . . . . . .   5
  113.  
  114.           Device I/O Control (IOCtl) Commands . . . . . . . . . . . . .   6
  115.                41h - Set Bit Rate . . . . . . . . . . . . . . . . . . .   7
  116.                42h - Set Line Characteristics . . . . . . . . . . . . .   8
  117.                43h - Extended Set Bit Rate  . . . . . . . . . . . . . .   9
  118.                44h - Transmit Byte Immediate  . . . . . . . . . . . .    10
  119.                45h - Set Break Off  . . . . . . . . . . . . . . . . .    10
  120.                46h - Set Modem Control Signals  . . . . . . . . . . .    11
  121.                47h - Hold Transmit  . . . . . . . . . . . . . . . . .    12
  122.                48h - Start Transmit . . . . . . . . . . . . . . . . .    12
  123.                4Bh - Set Break on . . . . . . . . . . . . . . . . . .    13
  124.                53h - Write Device Control Block (DCB)   . . . . . . .    13
  125.                54h - Write Extended Mode Parameters . . . . . . . . .    16
  126.                61h - Query Current Bit Rate . . . . . . . . . . . . .    17
  127.                62h - Query Line Characteristics . . . . . . . . . . .    17
  128.                63h - Query Extended Bit Rate  . . . . . . . . . . . .    18
  129.                64h - Query SIO Status . . . . . . . . . . . . . . . .    19
  130.                65h - Query Transmit Data Status . . . . . . . . . . .    20
  131.                66h - Query Current Modem Output Control Signals . . .    21
  132.                67h - Query Current Modem Input Signals  . . . . . . .    21
  133.                68h - Query Number of Characters in Receive Buffer . .    22
  134.                6Dh - Query SIO Error  . . . . . . . . . . . . . . . .    23
  135.                72h - Query SIO Event Information  . . . . . . . . . .    24
  136.                73h - Read Device Control Block (DCB)  . . . . . . . .    25
  137.                74h - Read Enhanced Mode Parameters  . . . . . . . . .    25
  138.  
  139.           Differences between SIO/VSIO and COM/VCOM . . . . . . . . .    26
  140.  
  141.           Appendix A, Hardware Port and IRQ Assignments . . . . . . .    27
  142.                Addresses and IRQs for COM1 and COM2 . . . . . . . . .    27
  143.                Defacto standard for COM3 and COM4 . . . . . . . . . .    27
  144.                Addresses and IRQ for COM3 through COM8 on the PS/2  .    27
  145.  
  146.           Appendix B, SIO Chips . . . . . . . . . . . . . . . . . . .    28
  147.                8250 . . . . . . . . . . . . . . . . . . . . . . . . .    28
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.                                                                         iii
  156.  
  157.                8250A  . . . . . . . . . . . . . . . . . . . . . . . .    28
  158.                16450  . . . . . . . . . . . . . . . . . . . . . . . .    29
  159.                16C451 . . . . . . . . . . . . . . . . . . . . . . . .    29
  160.                16550 (Non A . . . . . . . . . . . . . . . . . . . . .    29
  161.                16550A . . . . . . . . . . . . . . . . . . . . . . . .    29
  162.                16550AF  . . . . . . . . . . . . . . . . . . . . . . .    29
  163.                16550AFN . . . . . . . . . . . . . . . . . . . . . . .    29
  164.                16550s Made by Western Digital . . . . . . . . . . . .    30
  165.                16C551 . . . . . . . . . . . . . . . . . . . . . . . .    30
  166.                16C552 . . . . . . . . . . . . . . . . . . . . . . . .    30
  167.                16C554 . . . . . . . . . . . . . . . . . . . . . . . .    30
  168.                82510  . . . . . . . . . . . . . . . . . . . . . . . .    30
  169.  
  170.           Appendix C, Multi-Port Serial I/0 Cards . . . . . . . . . .    31
  171.                STB 4COM . . . . . . . . . . . . . . . . . . . . . . .    31
  172.  
  173.           Appendix D, Advanced SIO Options  . . . . . . . . . . . . .    32
  174.                Protection . . . . . . . . . . . . . . . . . . . . . .    32
  175.                Locked Baud Rate . . . . . . . . . . . . . . . . . . .    32
  176.                IRQ Reflection to DOS Process  . . . . . . . . . . . .    32
  177.                I/O Port Mapping to DOS Process  . . . . . . . . . . .    32
  178.  
  179.           Index . . . . . . . . . . . . . . . . . . . . . . . . . . .    33
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.                                                                           1
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.                                      WHAT IS SIO
  205.  
  206.           SIO is a Serial Input/Output (SIO) communications character
  207.           device driver.  It provides an interface between application
  208.           programs and the serial communications hardware.
  209.  
  210.           SIO had been designed as a high performance replacement for the
  211.           OS/2 device driver COM.SYS.  This manual documents the known
  212.           differences between COM.SYS and SIO.SYS.
  213.  
  214.           SIO only works with 8250 (type) serial I/O devices.  Such devices
  215.           include, but is not limited to the 8250A, 16450, 16550, 16550A
  216.           and the 82510.  If you have a PC that is an IBM or near
  217.           compatible which has a serial communication port, it is likely
  218.           that it contains one of these devices.  SIO will identify the
  219.           type of serial devices that it finds at load time.
  220.  
  221.           Like other Device Drivers, SIO will do very little standing
  222.           alone.  There must be an application(s) program that makes use of
  223.           SIO's functions before one will benefit from the use of SIO.
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.           2
  232.  
  233.                                  File System Requests
  234.  
  235.           SIO processes all file system requests made to it in one way or
  236.           another.  The following file system requests and how SIO
  237.           processes them may be of use to the application programmer.
  238.  
  239.           INIT           Driver initialization.
  240.           Read           Data transfer from driver to program.
  241.           Input Status   Get input status.
  242.           Input Flush    Terminate all pending input requests.
  243.           Write          Data transfer from program to driver.
  244.           Output Status  Get output status.
  245.           Output Flush   Terminate all pending output requests.
  246.           Open           Open the device for use.
  247.           Close          Close the device.
  248.           IOCTL          Device I/O control commands.
  249.  
  250.           Each of these file system requests are discussed in more detail
  251.           in the following.
  252.  
  253.                                 Driver Initialization
  254.  
  255.           During device driver initialization the command line is parsed,
  256.           memory for data and control buffers are allocated and the system
  257.           environment is examined.
  258.  
  259.           Buffers are allocated for the maximum number of ports that the
  260.           installed version of SIO can support (up to 16).
  261.  
  262.           The mouse port is determined and if it is a serial mouse, that
  263.           port is excluded from use by SIO.
  264.  
  265.           In the absents of any command line parameters, SIO will only
  266.           support (look for) COM1 and COM2 at the standard addresses.  COM3
  267.           and up will not be supported (or looked at) unless they are
  268.           specifically identified in the SIO command line.
  269.  
  270.                                          Read
  271.  
  272.           If another read is already in progress, the process issuing the
  273.           additional read is blocked (suspended) until the previous read
  274.           command completes.  When a read is started, that read is not
  275.           interrupted by additional reads.  If multiple reads are issued,
  276.           they are not necessarily processed in the order they were issued. 
  277.           Thus, applications may not see the read requests complete in the
  278.           order in which they were issued.
  279.  
  280.           The conditions that control when the read will complete are
  281.           controlled by the active (current) DCB when the read is started.
  282.  
  283.                                      Input Status
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.                                                                           3
  292.  
  293.           This function returns with "device busy" set if there is no data
  294.           in the receive buffer.  That is, busy is returned if the process
  295.           may be blocked if the application issues a read command.
  296.  
  297.                                      Input Flush
  298.  
  299.           This function causes the receive buffer to be cleared (made
  300.           empty).  Any threads that are blocked, waiting for a read, will
  301.           be restarted when this function is issued.
  302.  
  303.  
  304.                                         Write
  305.  
  306.           If another write is already in progress, the process issuing the
  307.           additional write is blocked (suspended) until the previous write
  308.           command completes.  When a write is started, that write is not
  309.           interrupted by additional writes.  If multiple writes are issued,
  310.           they are not necessarily processed in the order they were issued. 
  311.           Thus, applications may not see the write requests complete in the
  312.           order in which they were issued.
  313.  
  314.           The conditions that control when the write will complete are
  315.           controlled by the current DCB when the write is started.
  316.  
  317.  
  318.                                     Output Status
  319.  
  320.           This function returns with "device busy" set if the output buffer
  321.           is more than three quarters full.  That is, busy is returned if
  322.           the process may be blocked if the application issues a write
  323.           command.
  324.  
  325.                                      Output Flush
  326.  
  327.           This function causes the transmit buffer to be cleared (made
  328.           empty).  Any threads that are blocked, waiting for a read, will
  329.           be restarted when this function is issued.
  330.  
  331.  
  332.                                          Open
  333.  
  334.           There are basically two kinds of open.  They are, an Initial Open
  335.           and Additional (shared) Opens. The IBM documentation calls the
  336.           initial open a First Level Open.  An Initial Open is an open that
  337.           occurs when no other process has the communications port open. 
  338.           An Additional Open is when an open occurs and another process
  339.           already has the communications port open.  For an Additional Open
  340.           to occur, the Initial Opener must have issued an open allowing
  341.           shared access to the port.
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.           4
  350.  
  351.  
  352.  
  353.           Initial Open
  354.  
  355.           The IRQ associated with the comm port is claimed (taken) when the
  356.           Initial Open occurs.  If the associated IRQ is not available a
  357.           "Port in Use" error is returned.  At the time of this writing,
  358.           the IRQ is claimed allowing sharing.  However, the shared IRQ
  359.           claiming is done to circumvent anomalies in the OS, and in
  360.           actuality SIO will not concurrently share an IRQ with another
  361.           device driver.  The author found it necessary to claim (reset)
  362.           all interrupts directed to the interrupt service routine in order
  363.           to prevent lock ups of a communications port.  The IRQ mess may
  364.           be cleaned up at a future date when the OS problems are
  365.           corrected.
  366.  
  367.           During Initial Opens, DTR and RTS are set in accordance with the
  368.           current Device Control Block (DCB) settings.  If DTR Control Mode
  369.           is the "Enabled" option ( bits 1 and 0 of the DCB Flags1 byte
  370.           equal 01), then DTR is turned on.  Otherwise, DTR is unchanged by
  371.           the Initial Open.  Similarly, if RTS Control Mode is the
  372.           "Enabled" option ( bits 7 and 6 of the DCB Flags1 byte equal 01),
  373.           then RTS is turned on.  Otherwise, RTS is unchanged by the
  374.           Initial Open.
  375.  
  376.           The following actions also occur during an Initial Open:
  377.  
  378.                The Xon and Xoff characters are set to 11h and 13h
  379.                respectively.
  380.  
  381.                The transmit and receive buffers and structures are cleared
  382.                and re-initialized.
  383.  
  384.                Status bits are reset.
  385.  
  386.           If the Initial Opener is an OS/2 process (not a DOS process) then
  387.           the Read time out processing is set to "Normal" in the current
  388.           DCB.
  389.  
  390.           Additional Open
  391.  
  392.           A count of active opens is incremented.  No changes are made to
  393.           current comm settings.
  394.  
  395.  
  396.                                         Close
  397.  
  398.           There are two basic kinds of closes.  They are, an Intermediate
  399.           Close and a Last Close.
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.                                                                           5
  408.  
  409.           Intermediate Close
  410.  
  411.           An intermediate close occurs when a process issues a close and
  412.           other processes still have the communications port opened.  This
  413.           type of close simply decrements an open count and returns.  No
  414.           action or changes take place at the communications port.
  415.  
  416.           Last Close
  417.  
  418.           The last close occurs when a process issues a close and no other
  419.           process has the communications port open.  If there are any
  420.           writes pending or incomplete, the process is blocked (suspended)
  421.           until the writes complete or time out.  If 60 seconds pass with
  422.           no activity at the communications port, the port is forced to
  423.           close and all writes are terminated.  If any processes are
  424.           blocked (suspended) waiting on a read, they are forced to return
  425.           to the process that issued the read.
  426.  
  427.           If either DTR Control Mode or RTS Control Mode are set to
  428.           "Enabled" by the current DCB, then the appropriate signal(s) is
  429.           turned off.
  430.  
  431.           Finally, the IRQ is released back to the OS.
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.           6
  440.  
  441.                          Device I/O Control (IOCtl) Commands
  442.  
  443.           The following Generic IOCtl functions are supported by SIO.
  444.                41h - Set Bit Rate
  445.                42h - Set Line Characteristics
  446.                43h - Extended Set Bit Rate
  447.                44h - Transmit Byte Immediate
  448.                45h - Set Break Off
  449.                46h - Set Modem Control Signals
  450.                47h - Hold Transmit
  451.                48h - Start Transmit (after hold)
  452.                4Bh - Set Break On
  453.                53h - Write Device Control Block (DCB) 
  454.                54h - Write Extended Mode Parameters
  455.                61h - Query Current Bit Rate
  456.                62h - Query Line Characteristics
  457.                63h - Query Extended Bit Rate
  458.                64h - Query SIO Status
  459.                65h - Query Transmit Data Status
  460.                66h - Query Current Modem Output Control Signals
  461.                67h - Query Current Modem Input Signals
  462.                68h - Query Number of Characters in Receive Buffer
  463.                69h - Query Number of Characters in Transmit Buffer
  464.                6Dh - Query SIO Error
  465.                72h - Query SIO Event Information
  466.                73h - Read Device Control Block (DCB)
  467.                74h - Read Enhanced Mode Parameters
  468.  
  469.           All IOCtl functions are called with a uniform set of parameters. 
  470.           This uniform set of parameters is:
  471.                DWORD     Address of a data packet.
  472.                WORD      Size of the data packet in bytes.
  473.                DWORD     Address of the parameter packet.
  474.                WORD      Size of the parameter packet in bytes.
  475.                WORD      Function code.
  476.                WORD      Category code (01 for SIO).
  477.                WORD      Handle for the opened device. 
  478.  
  479.           Each IOCtl function may or may not have a data or parameter
  480.           packet.  If a given IOCtl function specifies a NULL parameter or
  481.           data packet, the address of the appropriate item must be NULL
  482.           (zero) in the parameters.  Passing an invalid data or parameter
  483.           packet may result in a General Protection Fault.
  484.  
  485.           Each of these IOCtl commands are described in detail on the
  486.           following pages.
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.                                                                           7
  495.  
  496.  
  497.                                   41h - Set Bit Rate
  498.  
  499.           Parameter Packet
  500.  
  501.                ┌──────────────────────────────────────┐
  502.                │         Item                Type     │
  503.                ├───────────────────────────┬──────────┤
  504.                │ Bit/Baud Rate             │ WORD     │
  505.                └───────────────────────────┴──────────┘
  506.  
  507.                "Bit Rate" is any number from 1 to 65535.  SIO does not
  508.                attempt to validate a given bit rate.  SIO rounds the given
  509.                bit rate to the nearest multiple of 10.  For example, 75 is
  510.                rounded to 80 and 134 is rounded to 130.
  511.  
  512.                Note that the hardware may not be able to generate the given
  513.                bit rate.  For example, if a computer has a standard
  514.                communications card installed and if a bit rate of 65500 is
  515.                specified, the nearest bit rate that can be generated will
  516.                be set, 57600 in this case.
  517.  
  518.                To set bit rates in excess of 57600, see IOCtl function 43h,
  519.                Extended Set Bit Rate.
  520.  
  521.                Some commonly used bit rates that can be set with this
  522.                function are:
  523.  
  524.                110       3600
  525.                150       4800
  526.                300       7200
  527.                600       9600
  528.                1200      19200
  529.                1800      28800
  530.                2000      38400
  531.                2400      57600
  532.  
  533.  
  534.           Data Packet - None
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.           8
  543.  
  544.  
  545.                             42h - Set Line Characteristics
  546.  
  547.           Parameter Packet
  548.  
  549.                ┌──────────────────────────────────────┐
  550.                │         Item                Type     │
  551.                ├───────────────────────────┬──────────┤
  552.                │ Data Bits Per Character   │ BYTE     │
  553.                ├───────────────────────────┼──────────┤
  554.                │ Parity Setting            │ BYTE     │
  555.                ├───────────────────────────┼──────────┤
  556.                │ Stop Bit Setting          │ BYTE     │
  557.                └───────────────────────────┴──────────┘
  558.  
  559.                Data Bits Per Character may be 5, 7, or 8, all other values
  560.                are invalid.
  561.  
  562.                Parity Setting may have the following values, all other
  563.                values are invalid:
  564.                     0 - No parity bit.
  565.                     1 - Odd parity.
  566.                     2 - Even parity.
  567.                     3 - Mark parity (1).
  568.                     4 - Space parity (0).
  569.  
  570.  
  571.                Stop Bit Setting may have the following values, all other
  572.                values are invalid:
  573.                     0 - 1 stop bit.
  574.                     1 - 1.5 stop bit (valid with 5 data bit characters).
  575.                     2 - 2 stop bits.
  576.  
  577.  
  578.           Data Packet - None
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.                                                                           9
  587.  
  588.  
  589.                              43h - Extended Set Bit Rate
  590.  
  591.           Parameter Packet
  592.  
  593.                ┌──────────────────────────────────────┐
  594.                │         Item                Type     │
  595.                ├───────────────────────────┬──────────┤
  596.                │ Bit/Baud Rate             │ DWORD    │
  597.                ├───────────────────────────┼──────────┤
  598.                │ Fraction                  │ BYTE     │
  599.                └───────────────────────────┴──────────┘
  600.  
  601.  
  602.                "Bit Rate" is the desired bit/baud rate.  As of this
  603.                writing, the maximum bit rate supported by SIO is 115200. 
  604.                SIO does not attempt to validate a given bit rate.  SIO
  605.                rounds the given bit rate to the nearest multiple of 10. 
  606.                For example, 75 is rounded to 80 and 134 is rounded to 130.
  607.  
  608.                Note that the hardware may not be able to generate the given
  609.                bit rate.  For example, if a computer has a standard
  610.                communications card installed and if a bit rate of 65500 is
  611.                specified, the nearest bit rate that can be generated will
  612.                be set, 57600 in this case.
  613.  
  614.  
  615.                "Fraction" is used to set the fractional part of the bit
  616.                rate when a high degree of accuracy is needed.  As of this
  617.                writing, SIO does not support a "Fraction" other than zero.
  618.  
  619.                Some commonly used bit rates that can be set with this
  620.                function are:
  621.  
  622.                110       3600      115200
  623.                150       4800
  624.                300       7200
  625.                600       9600
  626.                1200      19200
  627.                1800      28800
  628.                2000      38400
  629.                2400      57600
  630.  
  631.           Data Packet - None
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.           10
  640.  
  641.  
  642.                             44h - Transmit Byte Immediate
  643.  
  644.           Parameter Packet
  645.  
  646.                ┌──────────────────────────────────────┐
  647.                │         Item                Type     │
  648.                ├───────────────────────────┬──────────┤
  649.                │ Character to Transmit     │ BYTE     │
  650.                └───────────────────────────┴──────────┘
  651.  
  652.                "Character to Transmit" will be the next character loaded
  653.                into the UART for transmission.  If a previous transmit
  654.                immediate byte is still pending, it is lost.  This function
  655.                does not wait for the character to transmit before
  656.                returning.
  657.  
  658.                This function may be used by an application program as one
  659.                of a set of functions to implement its own Xon/Xoff type
  660.                handshaking.
  661.  
  662.           Data Packet - None
  663.  
  664.  
  665.                                  45h - Set Break Off
  666.  
  667.           Parameter Packet - None
  668.  
  669.                Look!! No Parameter Packet!
  670.  
  671.           Data Packet
  672.  
  673.                ┌──────────────────────────────────────┐
  674.                │         Item                Type     │
  675.                ├───────────────────────────┬──────────┤
  676.                │ SIO Error Word            │ WORD     │
  677.                └───────────────────────────┴──────────┘
  678.  
  679.                See function 6Dh "Query SIO Error" for a description of the
  680.                SIO Error Word.  This function does not reset any bits in
  681.                the SIO Error Word.
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.                                                                          11
  690.  
  691.  
  692.                            46h - Set Modem Control Signals
  693.  
  694.           Parameter Packet
  695.  
  696.                ┌──────────────────────────────────────┐
  697.                │         Item                Type     │
  698.                ├───────────────────────────┬──────────┤
  699.                │ DTR and RTS on mask       │ BYTE     │
  700.                ├───────────────────────────┼──────────┤
  701.                │ DTR and RTS off mask      │ BYTE     │
  702.                └───────────────────────────┴──────────┘
  703.  
  704.                Attempted changes in the the setting of signals that are
  705.                used as flow control signals are ignored.  The current DCB
  706.                determines if either or both RTS and DTR are used as a flow
  707.                control signal.
  708.  
  709.                The setting of bit 0 affects DTR and the setting of bit 1
  710.                affects RTS.  Ones in the "on mask" specifies which of the
  711.                two signals are to be turned on, and zeros in the "off mask"
  712.                specify which of the two signals are to be turned off.
  713.  
  714.                Some examples are:
  715.                     On Mask        Off Mask
  716.                     01h            0FFh      Turn DTR on
  717.                     00h            0FEh      Turn DTR off
  718.                     02h            0FFh      Turn RTS on
  719.                     00h            0FDh      Turn RTS off
  720.                     03h            0FFh      Turn RTS and DTR on
  721.                     00h            0FCh      Turn RTS and DTR off
  722.  
  723.                If both on and off are specified for the setting of a
  724.                signal, the result is undefined.
  725.  
  726.           Data Packet
  727.  
  728.                ┌──────────────────────────────────────┐
  729.                │         Item                Type     │
  730.                ├───────────────────────────┬──────────┤
  731.                │ SIO Error Word            │ WORD     │
  732.                └───────────────────────────┴──────────┘
  733.  
  734.                See function 6Dh "Query SIO Error" for a description of the
  735.                SIO Error Word.  This function does not reset any bits in
  736.                the SIO Error Word.
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.           12
  745.  
  746.  
  747.                                  47h - Hold Transmit
  748.  
  749.           Parameter Packet - None
  750.  
  751.           Data Packet - None
  752.  
  753.                This function will disable the transmitter.  The transmitter
  754.                will not be enabled again unless IOCtl function 48h is
  755.                issued.  If the transmitter is already disabled, this call
  756.                has no effect.
  757.  
  758.                This function can be used as part of a set that allows an
  759.                application to implement its own Xon/Xoff type handshaking.
  760.  
  761.                Note that this is different from how COM.SYS implements this
  762.                function.  COM.SYS will re-enable the transmitter if an Xon
  763.                is received while SIO will not.
  764.  
  765.  
  766.                                  48h - Start Transmit
  767.  
  768.           Parameter Packet - None
  769.  
  770.           Data Packet - None
  771.  
  772.                This function will enable the transmitter, usually following
  773.                an IOCtl function 47h.  If the transmitter is already
  774.                enabled, this call has no effect.
  775.  
  776.                This function can be used as part of a set that allows an
  777.                application to implement its own Xon/Xoff type handshaking.
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.                                                                          13
  786.  
  787.  
  788.                                   4Bh - Set Break on
  789.  
  790.           Parameter Packet - None
  791.  
  792.                Look!! No Parameter Packet!
  793.  
  794.           Data Packet
  795.  
  796.                ┌──────────────────────────────────────┐
  797.                │         Item                Type     │
  798.                ├───────────────────────────┬──────────┤
  799.                │ SIO Error Word            │ WORD     │
  800.                └───────────────────────────┴──────────┘
  801.  
  802.                See function 6Dh "Query SIO Error" for a description of the
  803.                SIO Error Word.  This function does not reset any bits in
  804.                the SIO Error Word.
  805.  
  806.  
  807.                        53h - Write Device Control Block (DCB) 
  808.  
  809.           This is where the action is!  See also function 73h (Read DCB).
  810.  
  811.           Parameter Packet
  812.  
  813.                ┌──────────────────────────────────────┐
  814.                │         Item                Type     │
  815.                ├───────────────────────────┬──────────┤
  816.                │ Write Timeout             │ WORD     │
  817.                ├───────────────────────────┼──────────┤
  818.                │ Read Timeout              │ WORD     │
  819.                ├───────────────────────────┼──────────┤
  820.                │ Flags1                    │ BYTE     │
  821.                ├───────────────────────────┼──────────┤
  822.                │ Flags2                    │ BYTE     │
  823.                ├───────────────────────────┼──────────┤
  824.                │ Flags3                    │ BYTE     │
  825.                ├───────────────────────────┼──────────┤
  826.                │ Error Replacement Byte    │ BYTE     │
  827.                ├───────────────────────────┼──────────┤
  828.                │ Break Replacement Byte    │ BYTE     │
  829.                ├───────────────────────────┼──────────┤
  830.                │ Xon Character             │ BYTE     │
  831.                ├───────────────────────────┼──────────┤
  832.                │ Xoff Character            │ BYTE     │
  833.                └───────────────────────────┴──────────┘
  834.  
  835.  
  836.                "Write Timeout"  The write timeout is given in hundredths of
  837.                a second, relative to zero.  That is, 0 specifies 0.01
  838.                seconds and 1 specifies 0.02 seconds.
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.           14
  847.  
  848.                "Read Timeout" The read timeout is given in hundredths of a
  849.                second, relative to zero.  That is, 0 specifies 0.01 seconds
  850.                and 1 specifies 0.02 seconds.
  851.  
  852.                "Flags1" is a bit flag.  The bits in the flag specify the
  853.                following:
  854.  
  855.                Bits 1 and 0        DTR Control Mode.
  856.                          00 - Disable changing DTR during Open and Close.
  857.                          01 - Enable Changing DTR during Open and Close.
  858.                          10 - DTR used for input handshaking (not supported
  859.                               by SIO).
  860.                          11 - Invalid
  861.  
  862.                Bit 2,    Must be zero
  863.                Bit 3,    Off to ignore CTS.  Forced on if RTS is handshake.
  864.                Bit 4,    DSR is handshake.  Not supported by SIO.
  865.                Bit 5,    DCD required to transmit.  Not supported by SIO.
  866.                Bit 6,    DSR required to receive.
  867.                Bit 7,    Must be zero.
  868.  
  869.           ─────────────────────────────────────
  870.  
  871.                "Flags2" is a bit flag.  The bits in the flag specify the
  872.                following:
  873.  
  874.                Bit 0,    SIO is to honor Xon/XOff received from remote.
  875.                Bit 1,    SIO may send Xon/Xoff to the remote.
  876.                Bit 2,    Enable error replacement character.  Not supported
  877.                          by SIO.
  878.  
  879.                Bit 3,    Enable null stripping.  Not supported by SIO.
  880.                Bit 4,    Enable break replacement character.  Not supported
  881.                          by SIO.
  882.  
  883.                Bit 5,    Enable Full duplex.  Half duplex is not supported
  884.                          by SIO.
  885.  
  886.                Bits 7 and 6        RTS Control Mode
  887.                          00 - Disable changing RTS during Open and Close.
  888.                          01 - Enable Changing RTS during Open and Close.
  889.                          10 - RTS used for input handshaking.
  890.                          11 - Toggle on transmit (half duplex).  Not
  891.                               supported by SIO.
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.                                                                          15
  900.  
  901.                "Flags3" is a bit flag.  The bits in the flag specify the
  902.                following:
  903.  
  904.                Bit 0,    Enable infinite write timeout processing.  When
  905.                          set, a write timeout will not occur.
  906.  
  907.                Bits 2 and 1        Read timeout processing
  908.                          00 - Invalid.
  909.                          01 - Normal read time out.
  910.                          10 - Wait for something.  Reads will return before
  911.                               a timeout occurs if something received.
  912.                          11 - No Wait.  Reads will return immediately with
  913.                               any available data.
  914.  
  915.                Bits 4 and 3        FIFO Control
  916.                          00 - No change in FIFO state.
  917.                          01 - Disable FIFO buffers.
  918.                          10 - Enable FIFO buffers.
  919.                          11 - Dynamic enabling and disabling of FIFOS.
  920.  
  921.                     **Note, SIO forces bits 4 and 3 to "10".
  922.  
  923.                Bits 6 and 5        Set receive trigger level
  924.                          00 - 1 character.
  925.                          01 - 4 characters.
  926.                          10 - 8 characters.
  927.                          11 - 14 characters.
  928.  
  929.                     **Note, SIO forces bits 6 and 5 to "10".
  930.  
  931.                Bit 7               Transmit load count
  932.                          0 -  Load 1 character.
  933.                          1 -  Load 16 characters.
  934.  
  935.                     **Note, SIO forces bit 7 to "1".
  936.  
  937.                "Error Replacement Byte" Not supported by SIO.
  938.  
  939.                "Break Replacement Byte" Not supported by SIO
  940.  
  941.                "Xon Character" Any value, default is 11h.
  942.  
  943.                "Xoff Character" Any value, default is 13h.
  944.  
  945.           Data Packet - None
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.           16
  954.  
  955.  
  956.                          54h - Write Extended Mode Parameters
  957.  
  958.           Parameter Packet
  959.  
  960.                ┌──────────────────────────────────────┐
  961.                │         Item                Type     │
  962.                ├───────────────────────────┬──────────┤
  963.                │ Enhanced Flags1           │ BYTE     │
  964.                ├───────────────────────────┼──────────┤
  965.                │ Reserved                  │ DWORD    │
  966.                └───────────────────────────┴──────────┘
  967.  
  968.                This function is not supported (ignored) by SIO.  However
  969.                the bits are defined here for completeness.
  970.  
  971.                Enhanced Flags1
  972.                Bit 0 -   Enhanced mode hardware available (Query only 74h).
  973.                Bit 1 -   Enable enhanced mode.
  974.                Bits 3 and 2        DMA Receive Operation
  975.                     00 - Disable DMA receive capability.
  976.                     01 - Enable DMA receive capability.
  977.                     10 - Dedicate a DMA channel to receive.
  978.                     11 - Reserved.
  979.  
  980.                Bits 5 and 4        DMA Transmit Operation
  981.                     00 - Disable DMA transmit capability.
  982.                     01 - Enable DMA transmit capability
  983.                     10 - Dedicate a DMA channel to transmit.
  984.                     11 - Reserved.
  985.  
  986.                Bit 6 -   Receive in DMA mode (Query only, 74h).
  987.                Bit 7 -   Transmit in DMA mode (Query only, 74h).
  988.  
  989.           Data Packet - None.
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.                                                                          17
  998.  
  999.  
  1000.                              61h - Query Current Bit Rate
  1001.  
  1002.           Parameter Packet - None.
  1003.  
  1004.           Data Packet
  1005.  
  1006.                ┌──────────────────────────────────────┐
  1007.                │         Item                Type     │
  1008.                ├───────────────────────────┬──────────┤
  1009.                │ Bit/Baud Rate             │ WORD     │
  1010.                └───────────────────────────┴──────────┘
  1011.  
  1012.                See function 41h for more information.
  1013.  
  1014.  
  1015.                            62h - Query Line Characteristics
  1016.  
  1017.           Parameter Packet - None.
  1018.  
  1019.  
  1020.           Data Packet
  1021.  
  1022.  
  1023.                ┌──────────────────────────────────────┐
  1024.                │         Item                Type     │
  1025.                ├───────────────────────────┬──────────┤
  1026.                │ Data Bits Per Character   │ BYTE     │
  1027.                ├───────────────────────────┼──────────┤
  1028.                │ Parity Setting            │ BYTE     │
  1029.                ├───────────────────────────┼──────────┤
  1030.                │ Stop Bit Setting          │ BYTE     │
  1031.                ├───────────────────────────┼──────────┤
  1032.                │ Transmitting Break        │ BYTE     │
  1033.                └───────────────────────────┴──────────┘
  1034.  
  1035.                See function 42h for a definition of Data, Parity and Stop
  1036.                Bits.
  1037.  
  1038.                "Transmitting Break" is set to 1 if a break is being
  1039.                transmitted.  Otherwise, it is set to zero.
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.           18
  1048.  
  1049.  
  1050.                             63h - Query Extended Bit Rate
  1051.  
  1052.           Parameter Packet - None
  1053.  
  1054.  
  1055.           Data Packet
  1056.  
  1057.                ┌──────────────────────────────────────┐
  1058.                │         Item                Type     │
  1059.                ├───────────────────────────┬──────────┤
  1060.                │ Current Bit/Baud Rate     │ DWORD    │
  1061.                ├───────────────────────────┼──────────┤
  1062.                │ Fraction of Current       │ BYTE     │
  1063.                ├───────────────────────────┼──────────┤
  1064.                │ Minimum Bit/Baud Rate     │ DWORD    │
  1065.                ├───────────────────────────┼──────────┤
  1066.                │ Fraction of Minimum       │ BYTE     │
  1067.                ├───────────────────────────┼──────────┤
  1068.                │ Maximum Bit/Baud Rate     │ DWORD    │
  1069.                ├───────────────────────────┼──────────┤
  1070.                │ Fraction of Maximum       │ BYTE     │
  1071.                └───────────────────────────┴──────────┘
  1072.  
  1073.                "Current Bit/Baud Rate" is a 32 bit integer defining the
  1074.                current bit rate.
  1075.  
  1076.                "Fraction of Current" is always 0 when returned by SIO.
  1077.  
  1078.                "Minimum Bit/Baud Rate" is the minimum value that can be
  1079.                passed to SIO as a bit/baud rate.
  1080.  
  1081.                "Fraction of Minimum" is always 0 when returned by SIO. 
  1082.  
  1083.                "Maximum Bit/Baud Rate" is the maximum value that can be
  1084.                passed to SIO as a bit/baud rate.
  1085.  
  1086.                "Fraction of Maximum" is always 0 when returned by SIO.
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.                                                                          19
  1095.  
  1096.  
  1097.                                 64h - Query SIO Status
  1098.  
  1099.           Parameter Packet - None
  1100.  
  1101.           Data Packet
  1102.  
  1103.                ┌──────────────────────────────────────┐
  1104.                │         Item                Type     │
  1105.                ├───────────────────────────┬──────────┤
  1106.                │ SIO Status Byte           │ BYTE     │
  1107.                └───────────────────────────┴──────────┘
  1108.  
  1109.                "SIO Status Byte" is a bit flag.  The bits have the
  1110.                following meanings:
  1111.  
  1112.                Bit 0 -   Set if SIO is waiting for CTS before transmitting.
  1113.                Bit 1 -   Set if SIO is waiting for DSR before transmitting.
  1114.                Bit 2 -   Set if SIO is waiting for DCD before transmitting.
  1115.                Bit 3 -   Set if SIO is waiting because Xoff received or
  1116.                          transmitter is disabled (see function 47h).
  1117.  
  1118.                Bit 4 -   Reserved, not used by SIO.
  1119.                Bit 5 -   Set if SIO is waiting because break is being sent.
  1120.                Bit 6 -   Set if a transmit immediate is pending.
  1121.                Bit 7 -   Reserved, not used by SIO.
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.           20
  1130.  
  1131.  
  1132.                            65h - Query Transmit Data Status
  1133.  
  1134.           Parameter Packet - None.
  1135.  
  1136.           Data Packet
  1137.  
  1138.                ┌──────────────────────────────────────┐
  1139.                │         Item                Type     │
  1140.                ├───────────────────────────┬──────────┤
  1141.                │ Transmit Status           │ BYTE     │
  1142.                └───────────────────────────┴──────────┘
  1143.  
  1144.                "SIO Status Byte" is a bit flag.  The bits have the
  1145.                following meanings:
  1146.  
  1147.                Bit 0 -   Set if write in progress or pending.
  1148.                Bit 1 -   Set if any data is in the transmit buffer.
  1149.                Bit 2 -   Set if UART is currently transmitting.
  1150.                Bit 3 -   Set if a transmit immediate is pending.
  1151.                Bit 4 -   Set if an Xon needs to be sent.
  1152.                Bit 5 -   Set if an Xoff needs to be sent.
  1153.                Bit 6 -   Reserved
  1154.                Bit 7 -   Reserved
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.                                                                          21
  1163.  
  1164.  
  1165.                    66h - Query Current Modem Output Control Signals
  1166.  
  1167.  
  1168.           Parameter Packet - None.
  1169.  
  1170.           Data Packet
  1171.  
  1172.                ┌──────────────────────────────────────┐
  1173.                │         Item                Type     │
  1174.                ├───────────────────────────┬──────────┤
  1175.                │ Modem Output Signals      │ BYTE     │
  1176.                └───────────────────────────┴──────────┘
  1177.  
  1178.                "Modem Output Signals" is a bit flag.  The bits have the
  1179.                following meanings:
  1180.  
  1181.                Bit 0 -   Set if DTR is currently on.
  1182.                Bit 1 -   Set if RTS is currently on.
  1183.                Bits 2-7  Reserved, set to zero by SIO.
  1184.  
  1185.  
  1186.                        67h - Query Current Modem Input Signals
  1187.  
  1188.           Parameter Packet - None.
  1189.  
  1190.           Data Packet
  1191.  
  1192.                ┌──────────────────────────────────────┐
  1193.                │         Item                Type     │
  1194.                ├───────────────────────────┬──────────┤
  1195.                │ Modem Input Signals       │ BYTE     │
  1196.                └───────────────────────────┴──────────┘
  1197.  
  1198.                "Modem Output Signals" is a bit flag.  The bits have the
  1199.                following meanings:
  1200.  
  1201.                Bits 0-3  Reserved, set to zero by SIO.
  1202.                Bit 4 -   Clear To Send (CTS) is active.
  1203.                Bit 5 -   Data Set Ready (DSR) is active.
  1204.                Bit 6 -   Ring Indicator (RI), trailing edge detected.
  1205.                Bit 7 -   Data Carrier Detect (DCD) is active.
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.           22
  1214.  
  1215.  
  1216.                   68h - Query Number of Characters in Receive Buffer
  1217.  
  1218.           Parameter Packet - None.
  1219.  
  1220.           Data Packet
  1221.  
  1222.                ┌──────────────────────────────────────┐
  1223.                │         Item                Type     │
  1224.                ├───────────────────────────┬──────────┤
  1225.                │ Number of Bytes Buffered  │ WORD     │
  1226.                ├───────────────────────────┼──────────┤
  1227.                │ Byte Size of the Buffer   │ WORD     │
  1228.                └───────────────────────────┴──────────┘
  1229.  
  1230.                Self explaining.
  1231.  
  1232.  
  1233.                  69h - Query Number of Characters in Transmit Buffer
  1234.  
  1235.           Parameter Packet - None.
  1236.  
  1237.           Data Packet
  1238.  
  1239.                ┌──────────────────────────────────────┐
  1240.                │         Item                Type     │
  1241.                ├───────────────────────────┬──────────┤
  1242.                │ Number of Bytes Buffered  │ WORD     │
  1243.                ├───────────────────────────┼──────────┤
  1244.                │ Byte Size of the Buffer   │ WORD     │
  1245.                └───────────────────────────┴──────────┘
  1246.  
  1247.                Self explaining.
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.                                                                          23
  1256.  
  1257.  
  1258.                                 6Dh - Query SIO Error
  1259.  
  1260.  
  1261.           Parameter Packet - None.
  1262.  
  1263.           Data Packet
  1264.  
  1265.                ┌──────────────────────────────────────┐
  1266.                │         Item                Type     │
  1267.                ├───────────────────────────┬──────────┤
  1268.                │ SIO Error Word            │ WORD     │
  1269.                └───────────────────────────┴──────────┘
  1270.  
  1271.                "SIO Error Word" is a bit flag.  The bits have the following
  1272.                meaning:
  1273.  
  1274.                Bit 0 -   Set if a buffer overrun has occurred.
  1275.                Bit 1 -   Set if an overrun occurred at the UART.
  1276.                Bit 2 -   Set if the UART detected a parity error.
  1277.                Bit 3 -   Set if the UART detected a framing error.
  1278.                Bits 4-15 Reserved, set to zero by SIO.
  1279.  
  1280.                All bits of the SIO Error Word are reset prior to returning
  1281.                to the caller.
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.           24
  1290.  
  1291.  
  1292.                           72h - Query SIO Event Information
  1293.  
  1294.           Parameter Packet - None.
  1295.  
  1296.           Data Packet
  1297.  
  1298.                ┌──────────────────────────────────────┐
  1299.                │         Item                Type     │
  1300.                ├───────────────────────────┬──────────┤
  1301.                │ SIO Event Word            │ WORD     │
  1302.                └───────────────────────────┴──────────┘
  1303.  
  1304.                "SIO Event Word" is a bit flag.  The bits have the following
  1305.                meaning:
  1306.  
  1307.                Bit 0 -   Set when a receive character is transferred from
  1308.                          the UART to the receive buffer.
  1309.                Bit 1 -   Set when a receive (Read) timeout occurs.
  1310.                Bit 2 -   Set if the transmit buffer is empty.
  1311.                Bit 3 -   Set if Clear To Send (CTS) has changed state.
  1312.                Bit 4 -   Set if Data Set Ready (DSR) has changed state.
  1313.                Bit 5 -   Set if Data Carrier Detect (DCD) has changed
  1314.                          state.
  1315.                Bit 6 -   Set if a break has been detected.
  1316.                Bit 7 -   Set if a framing, parity, or overrun error has
  1317.                          occurred.
  1318.                Bit 8 -   Set if trailing edge of Ring Indicator (RI) has
  1319.                          occurred.
  1320.                Bits 9-15 Reserved, set to zero by SIO.
  1321.  
  1322.                All bits are reset prior to returning to the caller.
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.                                                                          25
  1331.  
  1332.  
  1333.                         73h - Read Device Control Block (DCB)
  1334.  
  1335.           Parameter Packet - None.
  1336.  
  1337.  
  1338.           Data Packet
  1339.  
  1340.                ┌──────────────────────────────────────┐
  1341.                │         Item                Type     │
  1342.                ├───────────────────────────┬──────────┤
  1343.                │ Write Timeout             │ WORD     │
  1344.                ├───────────────────────────┼──────────┤
  1345.                │ Read Timeout              │ WORD     │
  1346.                ├───────────────────────────┼──────────┤
  1347.                │ Flags1                    │ BYTE     │
  1348.                ├───────────────────────────┼──────────┤
  1349.                │ Flags2                    │ BYTE     │
  1350.                ├───────────────────────────┼──────────┤
  1351.                │ Flags3                    │ BYTE     │
  1352.                ├───────────────────────────┼──────────┤
  1353.                │ Error Replacement Byte    │ BYTE     │
  1354.                ├───────────────────────────┼──────────┤
  1355.                │ Break Replacement Byte    │ BYTE     │
  1356.                ├───────────────────────────┼──────────┤
  1357.                │ Xon Character             │ BYTE     │
  1358.                ├───────────────────────────┼──────────┤
  1359.                │ Xoff Character            │ BYTE     │
  1360.                └───────────────────────────┴──────────┘
  1361.  
  1362.                See function 53h for a description of the parameters.
  1363.  
  1364.  
  1365.                          74h - Read Enhanced Mode Parameters
  1366.  
  1367.           Parameter Packet - None.
  1368.  
  1369.           Data Packet
  1370.  
  1371.                ┌──────────────────────────────────────┐
  1372.                │         Item                Type     │
  1373.                ├───────────────────────────┬──────────┤
  1374.                │ Enhanced Flags1           │ BYTE     │
  1375.                ├───────────────────────────┼──────────┤
  1376.                │ Reserved                  │ DWORD    │
  1377.                └───────────────────────────┴──────────┘
  1378.  
  1379.                See function 54h for a description of the Flags1 Byte.
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.           26
  1388.  
  1389.                       Differences between SIO/VSIO and COM/VCOM
  1390.           What follows is some of the differences between SIO/VSIO and
  1391.           COM/VCOM that are know to the author.
  1392.  
  1393.           1 -  COM.SYS will automatically seek out and support four
  1394.                comm ports, COM1 through COM4.  SIO.SYS will
  1395.                automatically seek out and support only COM1 and COM2. 
  1396.                If SIO.SYS is to support more than two comm ports, they
  1397.                must be defined in the command line that loads SIO.SYS. 
  1398.                For example, DEVICE=SIO.SYS (COM3) (COM4) will cause
  1399.                SIO.SYS to support four comm ports.
  1400.  
  1401.           2 -  In the absence of overrides in the command line,
  1402.                COM.SYS will seek out four comm ports in the sequence
  1403.                of I/O ports 3F8h, 2F8h, 3E8h and 2E8h.  The first port
  1404.                found in this sequence is given the logical name COM1,
  1405.                the second is COM2 etc.  This means that the comm port
  1406.                at 2F8h could become COM1.  In the opinion of the
  1407.                author, this confuses some users to frustration.
  1408.  
  1409.                With no command line overrides, SIO.SYS uses a fixed
  1410.                I/O port concept.  That is, COM1 is always at I/O port
  1411.                3F8h, COM2 is always at 2F8h, etc.  Another way of
  1412.                looking at this is;  if no comm port exists at port
  1413.                3F8h, then you do not have a COM1.  SIO.SYS will not
  1414.                move another (found) comm port into the logical COM1
  1415.                slot.
  1416.  
  1417.           3 -  VSIO opens a comm port for a DOS session with sharing
  1418.                allowed.  VCOM uses an "exclusive use" open for DOS
  1419.                sessions.
  1420.  
  1421.           4 -  SIO.SYS will accept any number between 50 and 115200 as a
  1422.                valid baud rate.  For example, if an application program
  1423.                attempts to set a baud rate of 9990 bps, COM.SYS will reject
  1424.                it and SIO.SYS will accept it.
  1425.  
  1426.           5 -  The last decimal digit of a baud rate given to SIO must be
  1427.                zero.  SIO.SYS will not support baud rates like 75 or 134. 
  1428.                If given, they will be rounded to 80 and 130 respectively.
  1429.  
  1430.           6 -  SIO/VSIO execute faster than COM/VCOM.  This means that some
  1431.                applications, that are timing dependant, may not work under
  1432.                SIO/VSIO that do work under COM/VCOM.
  1433.  
  1434.           7 -  VSIO optionally (and by default) simulates a 16550A for DOS
  1435.                sessions.  VCOM simulates a 8250/16450.
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.                                                                          27
  1444.  
  1445.                     Appendix A, Hardware Port and IRQ Assignments
  1446.  
  1447.           I have obtained the following information from various sources. 
  1448.           Accuracy is not guaranteed.  In fact, nothing in this document is
  1449.           guaranteed.
  1450.  
  1451.           Addresses and IRQs for COM1 and COM2
  1452.  
  1453.                COM1 uses 03F8h and IRQ4
  1454.                COM2 uses 02F8h and IRQ3
  1455.  
  1456.           Defacto standard for COM3 and COM4 for PC, XT and AT
  1457.  
  1458.                COM3 uses 03E8h and IRQ4
  1459.                COM4 uses 02E8h and IRQ3
  1460.  
  1461.           Addresses and IRQ for COM3 through COM8 on the PS/2
  1462.  
  1463.                COM3 uses 3220h and IRQ3
  1464.                COM4 uses 3228h and IRQ3
  1465.                COM5 uses 4220h and IRQ3
  1466.                COM6 uses 4228h and IRQ3
  1467.                COM7 uses 5220h and IRQ3
  1468.                COM8 uses 5228h and IRQ3
  1469.  
  1470.           All PCs (know to the author) prior to the PS/2 and EISA only use
  1471.           10 bits to address hardware I/0 ports.  Systems prior to the PS/2
  1472.           and EISA can not address the standard PS/2 addresses for COM3
  1473.           through COM8.  If an AT or below attempts to address COM3 through
  1474.           COM8 using the PS/2 addresses, only the low 10 bits of the
  1475.           address are used.  That is, the high 6 bits of the address will
  1476.           be ignored by the hardware.  This means that any reference to
  1477.           COM3 through COM8 will actually address ports 220h through 22Fh
  1478.           on older PCs.
  1479.  
  1480.           One should avoid expansion boards that use ports 220h through
  1481.           22Fh unless the expansion board is a serial I/O board. 
  1482.  
  1483.           SIO will (attempt to) determine the hardware architecture
  1484.           (ISA/EISA and PS/2) that it is being executed on and use the
  1485.           appropriate hardware port addresses for COM1 thru COM4 as
  1486.           defaults.
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.           28
  1495.  
  1496.                                 Appendix B, SIO Chips
  1497.  
  1498.  
  1499.           The following is a collection of comments developed from hearsay,
  1500.           random documents, experience, and technical specifications. So,
  1501.           take it with a grain of salt.  Order information from the various
  1502.           manufactures if you want accurate information.
  1503.  
  1504.           Very good reference books are available from National
  1505.           Semiconductor Corporation.  They cover most of the SIO devices
  1506.           (also called UARTs) that you will find in many PCs and clones.  I
  1507.           am not sure that books can be ordered directly from National
  1508.           Semiconductor. They may require that you get it from a
  1509.           distributor.  In any case, the address on the back of the one
  1510.           manual is:
  1511.  
  1512.                National Semiconductor Corporation
  1513.                2900 Semiconductor Drive
  1514.                P.O. Box 58090
  1515.                Santa Clara, CA 95052-8090
  1516.  
  1517.                Tel:(408)721-5000
  1518.                TWX:(910)339-9240
  1519.  
  1520.           8250
  1521.  
  1522.           As best that I know, the 8250 was the first SIO chip (integrated
  1523.           circuit) that was used by the IBM PC and many clones.  In my
  1524.           opinion, it was a poor choice on the part of IBM.  I feel many
  1525.           superior devices, at comparable prices, were readily available. 
  1526.           At that time, I feel the 8251A or the 8530 would have been better
  1527.           choices.  But, they used the 8250 and therefore we must use it.
  1528.  
  1529.           From a hardware standpoint the 8250 is a relatively slow device. 
  1530.           It is advisable that programmers not perform successive inputs or
  1531.           outputs to this device.  It seems that software programs can load
  1532.           the various registers of the 8250 faster than it can process the
  1533.           information.  The 8250 had a total of 7 registers.  The
  1534.           specifications state that 56kb is the maximum baud rate.
  1535.  
  1536.           8250A
  1537.  
  1538.           I believe the 8250A is the 8250 with some bug fixes.  I have no
  1539.           idea what the bugs may have been.  A quick glance at the
  1540.           specifications shows the speed of the 8250 and 8250A to be much
  1541.           the same.  The 8250A added an 8th register.  This additional
  1542.           register enables software to detect if an 8250 is installed.  The
  1543.           specifications state that 56kb is the maximum baud rate.
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.                                                                          29
  1552.  
  1553.           16450
  1554.  
  1555.           The 16450 seems to be a speeded up version of the 8250A.  There
  1556.           is no direct way (that I know of) for software to detect the
  1557.           difference between an 8250A and a 16450.  I believe the 16450 was
  1558.           developed to eliminate the need for software to insert delays
  1559.           between successive accesses to the device.  The specifications
  1560.           indicate the 16450 is a much faster device than its predecessors. 
  1561.           The additional speed is only the speed at which the processor can
  1562.           access the device.  The maximum baud rate for the 16450 is still
  1563.           stated at 56kb.  However, I have been told by some people that
  1564.           they have run the 16450 successfully at much higher speeds. I do
  1565.           not believe there was ever a 16450A.
  1566.  
  1567.           16C451
  1568.  
  1569.           The 16C451 is a CMOS version of the 16450.  CMOS is a term for
  1570.           the material and manufacturing process used to make the part. 
  1571.           CMOS typically uses less power than other technologies.  If you
  1572.           are not designing hardware, you should view the 16C451 as a
  1573.           16450.
  1574.  
  1575.           16550 (Non A)
  1576.  
  1577.           It is hard to find a 16550 (Non A).  I was told by National
  1578.           Semiconductor that they did everything they could to get all
  1579.           16550s back.  SIO will detect a 16550 and tell you if you have
  1580.           one.  I am told that the 16550 was installed in early PS/2
  1581.           systems.
  1582.  
  1583.           The 16550 was the first shot at a FIFOed version of the 8250
  1584.           family from National semiconductor.  However, I was told by
  1585.           National Semiconductor that the FIFOs of the 16550 are not
  1586.           reliable and they should not be enabled.  SIO will treat a 16550
  1587.           like a 16450.  In this mode, they are reliable.  National
  1588.           Semiconductor would not provide me with a specification for the
  1589.           16550.  However, I suspect its maximum baud rate is the same as
  1590.           the 16550A which is 256kb.
  1591.  
  1592.           16550A, 16550AF and 16550AFN
  1593.  
  1594.           In the manuals that I have, National Semiconductor does not
  1595.           explain the differences between the 16550A and the 16550AF.  I
  1596.           suspect the AF part may have a few bug fixes.  I believe the N in
  1597.           AFN describes packaging, ceramic versus plastic, DIP versus
  1598.           surface mount etc.
  1599.  
  1600.           In the opinion of the author, there is no substitute for the
  1601.           16550A (and its successors) in the 8250 type series.  The 16550A
  1602.           is compatible with most software written for the entire family of
  1603.           8250 type devices.  Programs that are 16550A aware can provide
  1604.           much improved performance over previous devices.
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.           30
  1613.  
  1614.  
  1615.           The maximum baud rate for the 16550A is specified at 256kb. 
  1616.           However, due to the hardware design of the PC et al, 115kb is the
  1617.           maximum baud rate that can be programmed by software.
  1618.  
  1619.           The 16550A can be plugged into the same socket that contains an
  1620.           8250, 8250A or 16450.  If your SIO expansion board has the SIO
  1621.           chips in sockets, you can upgrade to the 16550A by simply
  1622.           removing the old chips and replacing them with 16550As.
  1623.  
  1624.           The key to the performance increase of the 16550A is its FIFOs. 
  1625.           It has 16 byte FIFOs for both transmit and receive data.
  1626.  
  1627.           16550s Made by Western Digital
  1628.  
  1629.           I have been told, but I have not verified for myself, that 16550s
  1630.           made by Western Digital have a problem with their FIFOs when
  1631.           working at 2400 baud or below.
  1632.  
  1633.           16C551
  1634.  
  1635.           The 16C551 is a CMOS version of the 16550AF.  See the above
  1636.           description of the 16C451 for a discussion of CMOS.  Do not feel
  1637.           you need to upgrade from a 16550A or AF to a 16C551.  There is no
  1638.           gain from an existing users point of view.
  1639.  
  1640.           16C552
  1641.  
  1642.           The 16C552 is two 16C551s on a single chip.
  1643.  
  1644.           16C554
  1645.  
  1646.           The 16C554 is four 16C551s on a single chip.
  1647.  
  1648.           82510
  1649.  
  1650.           I believe Intel is the only company that manufactures the 82510. 
  1651.           The 82510 is feature rich with several modes of operation.  Its
  1652.           default mode is to operate as a 16450.  The 82510 has a 4 byte
  1653.           FIFO for both transmit and receive data.  A 4 byte FIFO is
  1654.           sufficient to provide significant performance over a basic 16450.
  1655.  
  1656.           The 82510 is small in size.  Therefore, it is found in many lap
  1657.           tops.
  1658.  
  1659.           The 82510 is somewhat of a sleeper.  I believe it would be much
  1660.           more widely used if Intel had promoted it more.  However, given a
  1661.           choice between the 82510 and the 16550A, I would select the
  1662.           16550A.
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.                                                                          31
  1671.  
  1672.                        Appendix C, Multi-Port Serial I/0 Cards
  1673.  
  1674.           I have received many requests for information about multi-port
  1675.           serial I/O card.  I will describe the boards that I know about
  1676.           (or have heard about) here.  I will add to the list as I receive
  1677.           precise information from users or develop it myself.
  1678.  
  1679.  
  1680.           STB 4COM  (ISA buss)
  1681.  
  1682.           I am very impressed with the STB 4COM card, they have almost got
  1683.           it.  Yes, its the same company that makes the VGA cards.  The
  1684.           4COM card uses a 16554 which is the equivalent of four 16550A. 
  1685.           Comm ports can use IRQs 2/9, 3, 4, 5, 10, 11, 12, and 15.  Any or
  1686.           all ports can share IRQs, and they have done this right.  I
  1687.           tested SIO with all four ports of the 4COM on IRQ12 and they
  1688.           worked correctly.  The user can select any of the following I/O
  1689.           port address for a comm port: 3F8, 2F8, 3E8, 2E8, 1A8, 1E8, 1F8,
  1690.           2A8.
  1691.  
  1692.           I purchased my 4COM card (for $119) from Steve Winter.  Steve can
  1693.           be reached at 800-735-5266 or 919-286-1502.
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.           32
  1702.  
  1703.                            Appendix D, Advanced SIO Options
  1704.  
  1705.  
  1706.           The following is provided for the experienced user. 
  1707.           Inexperienced users get themselves into a lot of trouble when
  1708.           trying to use these options and they cause an inordinate number
  1709.           of support problems. Therefore, the following are unsupported
  1710.           options.  If you use them, you must work out the problems
  1711.           yourself or ask a friend how they got it working.
  1712.  
  1713.           Protection
  1714.  
  1715.           Placing a dash "-" in the fourth parameter position, eg
  1716.           (COM1,3F8,IRQ4,-),  causes SIO not to provide any protection for
  1717.           that port.  The OS may still protect the port somewhat.  When the
  1718.           dash parameter is used the port is wide open (like DOS) for any
  1719.           process to access it.
  1720.  
  1721.           Locked Baud Rate
  1722.  
  1723.           Placing a colon and a baud rate following the communications
  1724.           port, eg (COM1:38400,3F8,IRQ4), causes the port to be locked at
  1725.           that baud rate.  No program, OS2 or DOS, is allowed to change the
  1726.           baud rate.
  1727.  
  1728.           IRQ Reflection to DOS Process
  1729.  
  1730.           Normally the IRQ that is reflected to a DOS process is the same
  1731.           as the actual hardware IRQ.  Placing a colon and an additional
  1732.           IRQ following the normal IRQ, eg (COM1,3F8,IRQ12:IRQ4), causes
  1733.           SIO/VSIO to reflect the IRQ to a DOS process on IRQ4 (in this
  1734.           example) even though the real hardware IRQ is IRQ12.  If one
  1735.           wishes SIO to automatically locate the hardware IRQ, then the
  1736.           following construct can be used: (COM1,3F8,:IRQ4).  Notice that
  1737.           the hardware IRQ is simply NOT specified.
  1738.  
  1739.           I/O Port Mapping to DOS Process
  1740.  
  1741.           Some DOS programs, such as CompuServe's CIM, insist that COM1 be
  1742.           at I/O port 03F8, COM2 at 02F8, etc.  On OS/2 systems, comm ports
  1743.           can have any I/O port address as specified by a command line.  If
  1744.           COM1 is not at I/O port 03F8 for some DOS programs, then COM1 can
  1745.           not be used by the DOS program.  The SIO command line allows the
  1746.           I/O ports to be mapped to a different address for DOS sessions,
  1747.           eg (COM1,FF80:03F8,IRQ12:IRQ4).  In this example, the real COM1
  1748.           is at FF80 on IRQ12, but is reflected to DOS processes on I/O
  1749.           ports 03F8 at IRQ4.  It is NOT necessary to map both the I/O port
  1750.           address and the IRQ.  When the I/O port is mapped to a DOS
  1751.           session, the UART will appear at BOTH I/O port addresses (FF80
  1752.           and 03F8 in the given example).
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.                                                                          33
  1761.  
  1762.                                         Index
  1763.  
  1764.           16450 . . . . . . . . . . . . . . . . . . . . . . . . . . . .  29
  1765.           16550 Non A . . . . . . . . . . . . . . . . . . . . . . . . .  29
  1766.           16550A  . . . . . . . . . . . . . . . . . . . . . . . . . . .  29
  1767.           16550AF . . . . . . . . . . . . . . . . . . . . . . . . . . .  29
  1768.           16550AFN  . . . . . . . . . . . . . . . . . . . . . . . . . .  29
  1769.           16550s Made by Western Digital  . . . . . . . . . . . . . . .  30
  1770.           16C451  . . . . . . . . . . . . . . . . . . . . . . . . . . .  29
  1771.           16C551  . . . . . . . . . . . . . . . . . . . . . . . . . . .  30
  1772.           16C552  . . . . . . . . . . . . . . . . . . . . . . . . . . .  30
  1773.           16C554  . . . . . . . . . . . . . . . . . . . . . . . . . . .  30
  1774.           8250  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  28
  1775.           8250A . . . . . . . . . . . . . . . . . . . . . . . . . . . .  28
  1776.           82510 . . . . . . . . . . . . . . . . . . . . . . . . . . . .  30
  1777.           Additional Open . . . . . . . . . . . . . . . . . . . . . . . . 4
  1778.           Addresses and IRQ for COM3 through COM8 on the PS/2 . . . . .  27
  1779.           Addresses and IRQs for COM1 and COM2  . . . . . . . . . . . .  27
  1780.           Appendix A, Hardware Notes  . . . . . . . . . . . . . . . . .  27
  1781.           Appendix B, SIO Chips . . . . . . . . . . . . . . . . . . . .  28
  1782.           Appendix C, Multi-Port Serial I/0 Cards . . . . . . . . . . .  31
  1783.           Appendix D, Advanced SIO Options  . . . . . . . . . . . . . .  32
  1784.           Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
  1785.           DCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
  1786.           Defacto standard for COM3 and COM4  . . . . . . . . . . . . .  27
  1787.           Device Control Block  . . . . . . . . . . . . . . . . . . . . . 4
  1788.           Differences between SIO/VSIO and COM/VCOM . . . . . . . . . .  26
  1789.           Driver Initialization . . . . . . . . . . . . . . . . . . . . . 2
  1790.           DTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
  1791.           DTR Control Mode  . . . . . . . . . . . . . . . . . . . . .  4, 5
  1792.           Extended Set Bit Rate . . . . . . . . . . . . . . . . . . . . . 9
  1793.           FIFO  . . . . . . . . . . . . . . . . . . . . . . . . . .  29, 30
  1794.           File System Requests  . . . . . . . . . . . . . . . . . . . . . 2
  1795.           First Level Open  . . . . . . . . . . . . . . . . . . . . . . . 3
  1796.           Hold Transmit . . . . . . . . . . . . . . . . . . . . . . . .  12
  1797.           I/O Port Mapping to DOS Process . . . . . . . . . . . . . . .  32
  1798.           Initial Open  . . . . . . . . . . . . . . . . . . . . . . . . . 4
  1799.           Input Flush . . . . . . . . . . . . . . . . . . . . . . . . . . 3
  1800.           Input Status  . . . . . . . . . . . . . . . . . . . . . . . . . 2
  1801.           Intermediate Close  . . . . . . . . . . . . . . . . . . . . . . 5
  1802.           IRQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
  1803.           IRQ Reflection to DOS Process . . . . . . . . . . . . . . . .  32
  1804.           Last Close  . . . . . . . . . . . . . . . . . . . . . . . . . . 5
  1805.           Locked Baud Rate  . . . . . . . . . . . . . . . . . . . . . .  32
  1806.           National Semiconductor Corporation  . . . . . . . . . . . . .  28
  1807.           Open  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
  1808.           Output Flush  . . . . . . . . . . . . . . . . . . . . . . . . . 3
  1809.           Output Status . . . . . . . . . . . . . . . . . . . . . . . . . 3
  1810.           Protection  . . . . . . . . . . . . . . . . . . . . . . . . .  32
  1811.           Query Current Bit Rate  . . . . . . . . . . . . . . . . . . .  17
  1812.           Query Current Modem Input Signals . . . . . . . . . . . . . .  21
  1813.           Query Current Modem Output Control Signals  . . . . . . . . .  21
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.           34
  1822.  
  1823.           Query Extended Bit Rate . . . . . . . . . . . . . . . . . . .  18
  1824.           Query Line Characteristics  . . . . . . . . . . . . . . . . .  17
  1825.           Query Number of Characters in Receive Buffer  . . . . . . . .  22
  1826.           Query Number of Characters in Transmit Buffer . . . . . . . .  22
  1827.           Query SIO Error . . . . . . . . . . . . . . . . . . . . . . .  23
  1828.           Query SIO Event Information . . . . . . . . . . . . . . . . .  24
  1829.           Query SIO Status  . . . . . . . . . . . . . . . . . . . . . .  19
  1830.           Query Transmit Data Status  . . . . . . . . . . . . . . . . .  20
  1831.           Read  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
  1832.           Read Device Control Block (DCB) . . . . . . . . . . . . . . .  25
  1833.           Read Enhanced Mode Parameters . . . . . . . . . . . . . . . .  25
  1834.           RTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
  1835.           RTS Control Mode  . . . . . . . . . . . . . . . . . . . . .  4, 5
  1836.           Set Bit Rate  . . . . . . . . . . . . . . . . . . . . . . . . . 7
  1837.           Set Break Off . . . . . . . . . . . . . . . . . . . . . . . .  10
  1838.           Set Break on  . . . . . . . . . . . . . . . . . . . . . . . .  13
  1839.           Set Line Characteristics  . . . . . . . . . . . . . . . . . . . 8
  1840.           Set Modem Control Signals . . . . . . . . . . . . . . . . . .  11
  1841.           SIO Chips . . . . . . . . . . . . . . . . . . . . . . . . . .  28
  1842.           Start Transmit  . . . . . . . . . . . . . . . . . . . . . . .  12
  1843.           STB 4COM  . . . . . . . . . . . . . . . . . . . . . . . . . .  31
  1844.           Transmit Byte Immediate . . . . . . . . . . . . . . . . . . .  10
  1845.           UART  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  28
  1846.           WHAT IS SIO . . . . . . . . . . . . . . . . . . . . . . . . . . 1
  1847.           Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
  1848.           Write Device Control Block (DCB)  . . . . . . . . . . . . . .  13
  1849.           Write Extended Mode Parameters  . . . . . . . . . . . . . . .  16
  1850.